﻿@model Cxuu.Models.SytemConfig

@{
    ViewData["Title"] = "系统配置";
}
<div class="content-top-nav">
    <h3 style="color:#444"><i class="layui-icon layui-icon-home"></i>@ViewData["Title"] </h3>
    <hr>
</div>

<div class="layui-fluid" style="margin-bottom:50px;">
    <div class="layui-row">
        <div class="layui-col-md12">
            <form class="layui-form" name="form">
                <div class="layui-tab layui-tab-brief">
                    <ul class="layui-tab-title">
                        <li class="layui-this">系统信息</li>
                        <li>上传设置</li>
                        <li>常用配置</li>
                    </ul>

                    <div class="layui-tab-content">

                        <div class="layui-tab-item  layui-show">

                                <div class="layui-field-box">
                                    <div class="layui-form-item">
                                        <label asp-for="SiteName" class="layui-form-label"></label>
                                        <div class="layui-input-inline" style="width:300px;">
                                            <input type="text" asp-for="SiteName" required lay-verify="required" placeholder="请输入系统名" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label asp-for="UnitOfUse" class="layui-form-label"></label>
                                        <div class="layui-input-inline" style="width:300px;">
                                            <input type="text" asp-for="UnitOfUse" required lay-verify="required" placeholder="请输入使用单位名称" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label asp-for="SiteUrl" class="layui-form-label"></label>
                                        <div class="layui-input-inline" style="width:260px;">
                                            <input type="text" asp-for="SiteUrl" required lay-verify="required" placeholder="请输入地址" autocomplete="off" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">如：https://cxuu.top</div>
                                    </div>
                                    <div class="layui-form-item layui-form-text">
                                        <label asp-for="Description" class="layui-form-label"></label>
                                        <div class="layui-input-block">
                                            <textarea type="text" asp-for="Description" required lay-verify="required" placeholder="请输入描述" autocomplete="off" class="layui-input" style="width:600px;height:80px;"></textarea>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label asp-for="Copyright" class="layui-form-label"></label>
                                        <div class="layui-input-inline" style="width:500px;">
                                            <input type="text" asp-for="Copyright" required lay-verify="required" placeholder="请输入版权" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label asp-for="Beian" class="layui-form-label"></label>
                                        <div class="layui-input-inline">
                                            <input type="text" asp-for="Beian" required lay-verify="required" placeholder="请输入备案号" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>
                                </div>
                        </div>
                        <div class="layui-tab-item">

                                <div class="layui-field-box">
                                    <div class="layui-form-item">
                                        <label asp-for="BaseDir" class="layui-form-label"></label>
                                        <div class="layui-input-inline" style="width:300px;">
                                            <input type="text" asp-for="BaseDir" required lay-verify="required" placeholder="请输入上传目录" autocomplete="off" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">如：uploads</div>
                                    </div>

                                    <div class="layui-form-item">
                                        <label asp-for="ImageDir" class="layui-form-label"></label>
                                        <div class="layui-input-inline" style="width:300px;">
                                            <input type="text" asp-for="ImageDir" required lay-verify="required" placeholder="请输入图片目录" autocomplete="off" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">如：Images</div>
                                    </div>

                                    <div class="layui-form-item">
                                        <label asp-for="ImageExt" class="layui-form-label"></label>
                                        <div class="layui-input-inline" style="width:300px;">
                                            <input type="text" asp-for="ImageExt" required lay-verify="required" placeholder="请输入图片类型" autocomplete="off" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">如： .jpg,gif,png</div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label asp-for="ImageSize" class="layui-form-label"></label>
                                        <div class="layui-input-inline" style="width:100px;">
                                            <input type="text" asp-for="ImageSize" required lay-verify="required" placeholder="请输入图片上传大小" autocomplete="off" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">单位:KB</div>
                                    </div>

                                    <hr>

                                    <div class="layui-form-item">
                                        <label asp-for="FileDir" class="layui-form-label"></label>
                                        <div class="layui-input-inline" style="width:300px;">
                                            <input type="text" asp-for="FileDir" required lay-verify="required" placeholder="请输入文件目录" autocomplete="off" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">如：Files</div>
                                    </div>

                                    <div class="layui-form-item">
                                        <label asp-for="NoticeAttDir" class="layui-form-label"></label>
                                        <div class="layui-input-inline" style="width:300px;">
                                            <input type="text" asp-for="NoticeAttDir" required lay-verify="required" placeholder="请输入消息附件目录" autocomplete="off" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">如：Notice</div>
                                    </div>

                                    <div class="layui-form-item">
                                        <label asp-for="FileExt" class="layui-form-label"></label>
                                        <div class="layui-input-inline" style="width:300px;">
                                            <input type="text" asp-for="FileExt" required lay-verify="required" placeholder="请输入文件类型" autocomplete="off" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">.txt,.zip,.7z,.doc,docx,.xls,.xlsx</div>
                                    </div>

                                    <div class="layui-form-item">
                                        <label asp-for="FileSize" class="layui-form-label"></label>
                                        <div class="layui-input-inline" style="width:100px;">
                                            <input type="text" asp-for="FileSize" required lay-verify="required" placeholder="请输入文件大小" autocomplete="off" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">单位:KB</div>
                                    </div>
                                </div>
                                            </div>
                        <div class="layui-tab-item">
                            <div class="layui-form-item">
                                <label asp-for="Marks" class="layui-form-label"></label>
                                <div class="layui-input-inline" style="width:600px;">
                                    <input type="text" asp-for="Marks" required lay-verify="required" placeholder="请输入文件报送标记标识" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">用于文件报送标记用，格式如：采用|一级|二级|三级|国务院采纳</div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                @if (await Authorizer.AuthView(PermissionKeys.Config_Edit))
                                {
                                    <button type="button" class="layui-btn" lay-submit lay-filter="saveBtn" id="saveBtn"><i class="layui-icon">&#xe605;</i>保存</button>
                                }
                            </div>
                        </div>


                    </div>

                </div>
            </form>
        </div>
    </div>
</div>
<script>
    layui.define(function () {
        var form = layui.form, $ = layui.jquery, element = layui.element;

        form.render();
        //监听提交
        form.on('submit(saveBtn)', function (data) {
            // $('#saveBtn').click(function () {
            // layer.msg(JSON.stringify(data.field));
            $.post('/Admin/Config/Edit', data.field , function (res) {
                //console.log("1");
                if (res.status == 1) {
                    layer.msg(res.msg, { icon: 1, time: 1000 }, function () {
                        loadMain('/Admin/Config/Index');
                    });
                } else {
                    layer.msg(res.msg, { icon: 2, anim: 6, time: 5000 });
                }
            });
            return false;
        });
    });
</script>
